package com.wins.bbs.auth;

import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;

public class JwtAuthenticationProvider implements AuthenticationProvider {
    @Override
    public Authentication authenticate(final Authentication authentication) throws AuthenticationException {
        if (authentication != null) {
            authentication.setAuthenticated((authentication.getPrincipal() != null));
        }
        return authentication;
    }

    @Override
    public boolean supports(final Class<?> auth) {
        return auth.isAssignableFrom(JwtAuthentication.class);
    }
}
